﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class TypeProcess_DisplayForm : System.Web.UI.Page
{
    private int ID
    {
        get
        {
            if (Request.QueryString["id"] == null)
                return 0;
            else
                return int.Parse(Request.QueryString["id"]);
        }
    }

    Model.TypeProcess typeProcess;

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            Model.TypeProcessManager typeProcessManager = new Model.TypeProcessManager();
             typeProcess = typeProcessManager.GetById(ID);
            txtName.Text = typeProcess.Name;
        }
    }

  

    protected void btnGoBack_Click(object sender, EventArgs e)
    {
        Response.Redirect("ListView.aspx");
    }

    protected void CommandBtn_Click(Object sender, CommandEventArgs e)
    {
       

        switch (e.CommandName)
        {

            case "Edit":

                Response.Redirect("EditForm.aspx?id=" + ID);
                break;

            case "Delete":
                Model.TypeProcessManager articlesManager = new Model.TypeProcessManager();
                articlesManager.Delete(ID);
            Response.Redirect("ListView.aspx");
                
                break;

           

        }

    }

}